#include <QApplication>
#include <testWidget.h>
#include <QPushButton>
#include <slidewidget.h>
#include <QTextBrowser>
#include <widget.h>

void addWidget(QGridLayout* layout, int r, int c){
    testWidget * m = new testWidget();
    testWidget * m1 = new testWidget();
    testWidget * m2 = new testWidget();
    testWidget * m3 = new testWidget();
    SlideWidget * Slider = new SlideWidget();
    QWidget * widget = new QWidget();
    QLabel* label = new QLabel("好好学习,天天向上",widget);
    QGridLayout * l = new QGridLayout(widget);
    l->addWidget(label);
    widget->setLayout(l);
    widget->setStyleSheet(QString("background-color: rgba(%1,%2,%3, 1)").arg(qrand()%255).arg(qrand()%255).arg(qrand()%255));
    Slider->setWidget(SlideWidget::UP,m);
    Slider->setWidget(SlideWidget::DOWN,m1);
    Slider->setWidget(SlideWidget::LEFT,m2);
    Slider->setWidget(SlideWidget::RIGHT,m3);
    Slider->setScale(0.7);
    Slider->setWidget(SlideWidget::CENTRE, widget);
    layout->addWidget(Slider,r,c);
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget ws;
    QGridLayout *layout = new QGridLayout(ws.getCentreWidget());
    layout->setSpacing(3);
    addWidget(layout, 0,0);
    addWidget(layout, 0,1);
    addWidget(layout, 1,0);
    addWidget(layout, 1,1);
    addWidget(layout, 2,0);
    addWidget(layout, 2,1);
    addWidget(layout, 3,0);
    addWidget(layout, 3,1);
    addWidget(layout, 4,0);
    addWidget(layout, 4,1);
    addWidget(layout, 5,0);
    addWidget(layout, 5,1);
    ws.setLayout(layout);
    ws.setWindowOpacity(0.9);
    ws.show();
    ws.resize(500,640);
    ws.setTitle("努力学习");
    return a.exec();
}
